// File Name: rs485_logic.h
// Author: kukukukuku~
// Date: 2024-07-16

#ifndef __RS485_LOGIC_H
#define __RS485_LOGIC_H

#include "./User/RS485/inc/rs485_ctrl.h"

//CRC16-Modbus算法
uint16_t crc16_modbus_calc(uint8_t *data, uint16_t dataLen);

//RS485发送数据
void rs485_send_data(const uint8_t *data, uint8_t dataLen);

//RS485数据处理
void rs485_data_handle(void);

//RS485 Modbus读单个寄存器响应
void rs485_modbus_read_single_reg_response(uint16_t regAddr, uint16_t regData);

//RS485 Modbus写单个寄存器响应
uint16_t rs485_modbus_write_single_reg_response(uint16_t regAddr, uint16_t data, uint16_t regDataMin, uint16_t regDataMax);

#endif //__RS485_LOGIC_H
